﻿@using RooHui.Infrastructure.Entities.Enum;
@{
    ViewBag.Title = "ProjectEdit";
    Layout = "~/Views/Shared/_Base.cshtml";
    var project = ViewBag.project;
    var spepolyids = "";
    var reslist = "";
    if (project != null)
    {
        foreach(var policy in project.PolicyList){
            if (!policy.IsAttach)
            {
                project.Policy = policy;
            }
            else
            {
                spepolyids = spepolyids + policy.ID + "|";
            }
        }
    
        foreach (var resource in project.ResourceList)
        {
            var pathname = resource.Path + ";" + resource.Name;
            reslist = reslist + pathname + "|";
        }
    }
}
@section head{
<script type="text/javascript" src="/Content/roohui/jquery-validation/jquery.validate.min.js"></script>
<script type="text/javascript" src="/Content/roohui/jquery-validation/jquery.metadata.js"></script>
<script type="text/javascript" src="/Content/roohui/jquery-validation/messages_cn.js"></script>
<script type="text/javascript" charset="utf-8" src="/Content/ueditor/editor_config.js"></script>
<script type="text/javascript" charset="utf-8" src="/Content/ueditor/editor_all_min.js"></script>
<script type="text/javascript" charset="utf-8" src="/Content/scripts/plug.js"></script>
<script type="text/javascript" charset="utf-8" src="/Content/scripts/swfupload/jquery.swfupload.js"></script>
<script type="text/javascript" charset="utf-8" src="/Content/scripts/swfupload/swfupload.js"></script>
}

<script type="text/javascript">
    var prodeseditor = null;
    var sepecids = [];
    var proresnames = [];
    $(function () {
        $('#frmProject').submit(function () {
            $('input[name="SpePolicyIDs"]').val(sepecids.join(':'));
            $('input[name="ProResNames"]').val(proresnames.join(':'));
        });

        // initial special policy list
        var prespeplyids = '@spepolyids';
        var speplyidarray = [];
        if (prespeplyids != null) {
            speplyidarray = prespeplyids.substr(0, prespeplyids.length - 1).split('|');
            for (var i = 0; i < speplyidarray.length; i++) {
                sepecids.push(speplyidarray[i]);
            }
        }

        // initial resourcelist
        var resList = '@reslist';
        var resarray = [];
        if (resList != null) {
            resarray = resList.substr(0, resList.length - 1).split('|');
            for (var i = 0; i < resarray.length; i++) {
                proresnames.push(resarray[i]);
            }
        }

        $('input[name="ProductName"]').ligerComboBox(
        {
            url: '/Product/GetEnabledProduct',
            valueField: 'ID',
            textField: 'ProductName',
            autocomplete: true,
            onSelected: function (value, text) {
                $('input[name="ProductID"]').val(value);
            }
        });

        $('input[name="GuaranteeCompany"]').ligerComboBox(
        {
            url: '/GuarCompany/GetEnabledGuarCompany',
            valueField: 'ID',
            textField: 'CompanyName',
            autocomplete: true,
            onSelected: function (value, text) {
                $('input[name="GuarCpyID"]').val(value);
            }
        });

        InitCombox();

        var selpolicyid;
        var selpolicyname;
        $('input[name="SpeicalPolicy"]').ligerComboBox(
        {
            url: '/Policy/GetEnabledpePolicyByStatus',
            valueField: 'Key',
            textField: 'Value',
            autocomplete: true,
            onSelected: function (value, text) {
                selpolicyid = value;
                selpolicyname = text;
            }
        });

        $('input[name="DurationType"]').ligerComboBox({ width: 65, data: [{ id: 0, text: '天' }, { id: 1, text: '月'}] });

        var balanceType = $('input[name="BalanceType"]').ligerComboBox();
        $('input[name="SettlementType"]').ligerComboBox(
        {
            data: [{ id: 0, text: '按比例' }, { id: 1, text: '固定值'}],
            onSelected: function (value, text) {
                initBalanceType(value);
            }
        });

        function initBalanceType(settlementType) {
            if (settlementType == 0) {
                balanceType.setData([{ id: 0, text: '每期等额本金利息' }, { id: 1, text: '每期结息到期还本' }, { id: 2, text: '到期结本息'}]);
                $("#danwei").html("%");
            }
            else {
                balanceType.setData([{ id: 3, text: '每期固定收益' }, { id: 4, text: '到期固定收益'}]);
                $("#danwei").html("元");
            }
        }

        $("#btnAddSpePolicy").click(function () {
            $("#lblmsg").html("");
            if (selpolicyid == -1 || selpolicyid == undefined) {
                $("#lblmsg").html('请选择特殊策略');
            }
            else {
                if (!sepecids.contain(selpolicyid)) {
                    sepecids.push(selpolicyid);
                    $("#tdselpolicy").css('display', 'block');
                }
                else {
                    $("#lblmsg").html('不能多次添加同一特殊策略');
                    return;
                }
                var tempstr = "<div id='" + selpolicyid + "'><span>" + selpolicyname + "&nbsp;</span><a href='javascript:void(0)' onclick='clearpolicy(" + selpolicyid + ")' style='text-decoration:none;'>[取消]</a><br /></div>";
                $("#selspepolicy").before(tempstr);
            }
        });

        $('input[name="btnSave"]').click(function () {
            $('input[name="Status"]').val(0);
            if (validate()) {
                $('#frmProject').submit();
            }
        });

        $('input[name="btnSubmit"]').click(function () {
            $('input[name="Status"]').val(1);
            if (validate()) {
                $('#frmProject').submit();
            }
        });

        $('input[name="btnCancel"]').click(function () {
            location.href = decodeURIComponent("/Project/Index");
        });

        $('input[name="btnClose"]').click(function () {
            location.href = decodeURIComponent("/Project/Index");
        });

    })

    function clearpolicy(policyid) {
        $("#" + policyid).remove();
        for (var j = 0; j < sepecids.length; j++) {
            if (sepecids[j] == policyid.toString()) {
                sepecids.splice(j, 1);
            }
        }
        if (sepecids.length == 0) {
            $("#tdselpolicy").css('display', 'none');
        }
    }

    function clearresource(resid) {
        var a = event.srcElement;
        $("#" + resid).remove();
        $(a).remove();
        for (var j = 0; j < proresnames.length; j++) {
            if (proresnames[j].split(';')[1].split('.')[0] == resid.toString()) {
                proresnames.splice(j, 1);
            }
        }
    }

    function InitCombox() {
        liger.get("ProductName").selectValue('@project.ProductID');
        liger.get("GuaranteeCompany").selectValue('@project.GuaranteeCompanyID');
    }

    function validate() {
        if ($('input[name="ProductName"]').val() == "请选择") {
            $("#lblmsg").html('请选择产品');
            return false;
        }

        if ($('input[name="ProjectTitle"]').val() == "") {
            $("#lblmsg").html('请输入项目名称');
            return false;
        }

        if ($('input[name="ProjectCode"]').val() == "") {
            $("#lblmsg").html('请输入项目代码');
            return false;
        }

        if ($('input[name="Financing"]').val() == "") {
            $("#lblmsg").html('请输入融资金额');
            return false;
        }

        if ($('input[name="IncreaseMoney"]').val() == "") {
            $("#lblmsg").html('请输入投资步长');
            return false;
        }

        if ($('input[name="MaxInvestment"]').val() == "") {
            $("#lblmsg").html('请输入最大投资额');
            return false;
        }

        if ($('input[name="OriginalRate"]').val() == "") {
            $("#lblmsg").html('请输入借款利率');
            return false;
        }

        if ($('input[name="GuaranteeRate"]').val() == "") {
            $("#lblmsg").html('请输入担保费率');
            return false;
        }

        if ($('input[name="CycleAmount"]').val() == "") {
            $("#lblmsg").html('请输入还款期数');
            return false;
        }

        if ($('input[name="WaitDay"]').val() == "") {
            $("#lblmsg").html('请输入有效期');
            return false;
        }

        if ($('input[name="ProjectDescription"]').val() == "") {
            $("#lblmsg").html('请输入项目描述');
            return false;
        }

        if ($('input[name="EnterpriseName"]').val() == "") {
            $("#lblmsg").html('请输入企业名称');
            return false;
        }

        if ($('input[name="EnterpriseCode"]').val() == "") {
            $("#lblmsg").html('请输入企业代码');
            return false;
        }

        if ($('input[name="EnterpriseCredit"]').val() == "") {
            $("#lblmsg").html('请输入企业信用');
            return false;
        }

        if ($('input[name="CapitalOperation"]').val() == "") {
            $("#lblmsg").html('请输入资金用途');
            return false;
        }

        if ($('input[name="GuaranteeCompany"]').val() == "请选择") {
            $("#lblmsg").html('请选择担保公司');
            return false;
        }

        if ($('input[name="CollateralOpinion"]').val() == "") {
            $("#lblmsg").html('请输入担保意见');
            return false;
        }

        if ($('input[name="RiskCotrolSummary"]').val() == "") {
            $("#lblmsg").html('请输入风险控制');
            return false;
        }

        if ($('input[name="PolicyName"]').val() == "") {
            $("#lblmsg").html('请输入策略名称');
            return false;
        }

        if ($('input[name="Duration"]').val() == "") {
            $("#lblmsg").html('请输入结算周期');
            return false;
        }

        if ($('input[name="Rate"]').val() == "") {
            $("#lblmsg").html('请输入年化收益');
            return false;
        }

        return true;
    }

    var swf = new plug.SwfUpload();
    function LoadUploadControl() {
        new plug.PopFrame().OpenFrame('fileuploadframe', 'btnflfclose', function () {
            swf.Bind('fileupload', {
                upload_url: "/Project/SWFPrepareUpload",
                file_types: "*.jpg;*.png",
                file_types_description: "jpg或png格式",
                commitbtn: 'btnupload',
                commiturl: '/Project/SWFUpload',
                commitdata: '',
                onDialogStart: function () {
                    $('#fileuploadframe_imgbox').children('#uploadframe_nophotobox').remove();
                },
                onLoad: function () {
                    $('#fileuploadframe_imgbox').append(
                            $('<div id="uploadframe_nophotobox" style="width:130px; padding-top:120px;margin-left:auto; margin-right:auto;"/>').append(
                                $('<img src="/Content/scripts/swfupload/no_photo.png" alt="noPhoto" />')
                            )
                        );
                    $('#fileuploadframe_hint').text('请选择不大于5MB的 PNG，JPG图片。');
                },
                onAppend: function (event, file) {
                    $('#fileuploadframe_imgbox').append(
                        $('<div id="' + file.name.replace('.', '_') + '" style="margin-right:8px;margin-top:5px;float:left;width:113px;height:113px;padding:5px;border:1px solid #ccc;"></div>')
                            .append($('<div style="width:20px;margin-left:auto;margin-right:auto;padding-top:50px;"><img alt="loading" src="/Content/scripts/swfupload/frameload.gif" /></div>'))
                    );
                },
                onError: function (event, file, errorCode, message) {
                    if (errorCode == -110) {
                        alert('文件：' + file.name + '过大，请选择不超过7MB的文件');
                    }
                    else {
                        alert('文件：' + file.name + '上传失败，请稍后再试');
                        var id = file.name.replace('.', '_');
                        if ($('#' + id)) {
                            $('#' + id).remove();
                        }
                    }
                },
                onSuccess: function (event, file, serverData) {
                    var data = eval('(' + serverData + ')');
                    var id = file.name.replace('.', '_');
                    if ($('#' + id)) {
                        $('#' + id).attr('id', data.name.replace('.', '_'))
                                .html('<div><img style="width:115px;height:95px;" alt="' + data.name.replace('.', '_') + '" src="' + data.path + '" /></div>' +
                                '<div style="padding-top:2px;float:right;cursor:pointer;" onclick="javascript:swf.DeleteItem(this);"><img alt="删除" style="width:16px;height:16px;" src="/Content/scripts/swfupload/Trash_Delete.png" /></div>');
                        swf.PutImage({ name: data.name, path: data.path, horizontal: data.horizontal.toString() });
                    }
                },
                commitComplete: function (files) {
                    $('#btnflfclose').trigger('click');
                    var width = 95, height = 115;
                    for (var i = 0, len = files.length; i < len; i++) {
                        if (/^true$/i.test(files[i].horizontal.toString())) {
                            width = 115;
                            height = 95;
                        }
                        var id = files[i].name.split('.')[0];
                        $('#resList').append(
                           $('<img alt="' + files[i].name + '" title="' + files[i].name + '" src="' + files[i].path
                            + '" style="width:' + width + 'px;height:' + height + 'px;"/>')); //<a href="javascript:void(0)" onclick="clearresource("' + files[i].name + '")"><br /><img alt="删除" style="width:16px;height:16px;" src="/Content/scripts/swfupload/Trash_Delete.png" /></a>'));

                        var pathname = files[i].path + ";" + files[i].name;
                        if (!proresnames.contain(pathname)) {
                            proresnames.push(pathname);
                        }
                    }
                }
            });
        }, function () {
            $('#fileuploadframe_imgbox').html('');
            $('#fileupload').html('');
            swf.uninstall();
        });
    }

    $.metadata.setType("attr", "validate");
    var v = $("#frmProject").validate({
        errorPlacement: function (lable, element) {
            if (element.hasClass("l-textarea")) {
                element.ligerTip({ content: lable.html(), target: element[0] });
            }
            else if (element.hasClass("l-text-field")) {
                element.parent().ligerTip({ content: lable.html(), target: element[0] });
            }
            else {
                lable.appendTo(element.parents("td:first").next("td"));
            }
        },
        success: function (lable) {
            lable.ligerHideTip();
            lable.remove();
        },
        submitHandler: function () {
            //todo
        }
    });

</script>

<div style="overflow-x:hidder;overflow-y:auto;height:100%">
<form action="/Project/ProjectEdit" method="post" id="frmProject" name="frmProject" style="background-color: white">
<input name="ProjectID" type="hidden" value="@project.ID"/>
<input name="ProductID" type="hidden"/>
<input name="SpePolicyIDs" type="hidden"/>
<input name="ProResNames" type="hidden"/>
<input name="GuarCpyID" type="hidden"/>
<input name="Status" type="hidden"/>

<div id="form1" class="liger-form" style="padding-top: 10px; padding-left:25px;">
    <div id="probaseinfo" style="padding-left:10px;">
        <table cellpadding="0" cellspacing="0" class="l-table-edit">
            <tr>
                <td align="right" class="l-table-edit-td">
                    <a href="javascript:;" style="text-decoration:none; color:Black;"><strong><h3>项目信息</h3></strong></a>
                </td>
            </tr>
            <tr>
                <td align="right" class="l-table-edit-td">
                    <span class="l-star">*</span>&nbsp;产品名称:
                </td>
                <td align="left" class="l-table-edit-td" colspan="2">
                    <input id="ProductName" name="ProductName" ltype="select" /> 
                </td>
                <td align="right" class="l-table-edit-td">
                    &nbsp;&nbsp;<span class="l-star">*</span>&nbsp;项目名称:
                </td>
                <td align="left" class="l-table-edit-td" colspan="2">
                    <input name="ProjectTitle" ltype="text" value="@project.ProjectTitle" />
                </td>
                <td align="right" class="l-table-edit-td">
                    &nbsp;&nbsp;<span class="l-star">*</span>&nbsp;项目代码:
                </td>
                <td align="left" class="l-table-edit-td" colspan="2">
                    <input name="ProjectCode" ltype="text" value="@project.ProjectCode" />
                </td>
            </tr>
            <tr>
                <td align="right" class="l-table-edit-td">
                    <span class="l-star">*</span>&nbsp;融资金额:
                </td>
                <td align="left" class="l-table-edit-td">
                    <input name="Financing" ltype="text" value="@project.Financing" />
                </td>
                <td align="left" style="width:20px;">
                    <span>元</span>
                </td>
                <td align="right" class="l-table-edit-td">
                    <span class="l-star">*</span>&nbsp;投资步长:
                </td>
                <td align="left" class="l-table-edit-td">
                    <input name="IncreaseMoney" ltype="text" value="@project.IncreaseMoney" />
                </td>
                <td align="left" style="width:20px;">
                    <span>元</span>
                </td>
                <td align="right" class="l-table-edit-td">
                    <span class="l-star">*</span>&nbsp;最大投资额:
                </td>
                <td align="left" class="l-table-edit-td">
                    <input name="MaxInvestment" ltype="text" value="@project.MaxInvestment" />
                </td>
                <td align="left" style="width:20px;">
                    <span>元</span>
                </td>
            </tr>
            <tr>
                <td align="right" class="l-table-edit-td">
                    <span class="l-star">*</span>&nbsp;借款利率:
                </td>
                <td align="left" class="l-table-edit-td">
                    <input name="OriginalRate" ltype="text" value="@project.OriginalRate" />
                </td>
                <td align="left" style="width:20px;">
                    <span>%</span>
                </td>
                <td align="right" class="l-table-edit-td">
                    <span class="l-star">*</span>&nbsp;担保费率:
                </td>
                <td align="left" class="l-table-edit-td">
                    <input name="GuaranteeRate" ltype="text" value="@project.GuaranteeRate" />
                </td>
                <td align="left" style="width:20px;">
                    <span>%</span>
                </td>
                <td align="right" class="l-table-edit-td">
                    <span class="l-star">*</span>&nbsp;还款期数:
                </td>
                <td align="left" class="l-table-edit-td" colspan="2">
                    <input name="CycleAmount" ltype="text" value="@project.CycleAmount"/>
                </td>
            </tr>
            <tr>
                <td align="right" class="l-table-edit-td">
                    <span class="l-star">*</span>&nbsp;有效期:
                </td>
                <td align="left" class="l-table-edit-td">
                    <input name="WaitDay" ltype="text" value="@project.WaitDay" />
                </td>
                <td align="left" style="width:20px;">
                    <span>天</span>
                </td>
            </tr>
            <tr>
                <td align="right" class="l-table-edit-td">
                    <span class="l-star">*</span>&nbsp;项目描述:
                </td>
                <td align="left" class="l-table-edit-td" colspan="8">
                    <textarea name="ProjectDescription" rows="5" cols="123">@project.ProjectDescription</textarea>
                </td>
            </tr>
        </table>
    </div>
    <div id="enterpriseinfo" style="padding-left:10px;">
        <table cellpadding="0" cellspacing="0" class="l-table-edit">
            <tr>
                <td align="right" class="l-table-edit-td">
                    <a href="javascript:;" style="text-decoration:none; color:Black;"><strong><h3>企业信息</h3></strong></a>
                </td>
            </tr>
            <tr>
                <td align="right" class="l-table-edit-td">
                    <span class="l-star">*</span>&nbsp;企业名称:
                </td>
                <td align="left" class="l-table-edit-td">
                    <input name="EnterpriseName" ltype="text" value="@project.Enterprise.EnterpriseName" />
                </td>
                <td align="right" class="l-table-edit-td">
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="l-star">*</span>&nbsp;企业代码:
                </td>
                <td align="left" class="l-table-edit-td">
                    <input name="EnterpriseCode" ltype="text" value="@project.Enterprise.EnterpriseCode" />
                </td>
                <td align="right" class="l-table-edit-td">
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="l-star">*</span>&nbsp;企业信用:
                </td>
                <td align="left" class="l-table-edit-td" colspan="3">
                    <input name="EnterpriseCredit" ltype="text" value="@project.Enterprise.EnterpriseCredit" />
                </td>
            </tr>
            <tr>
                <td align="right" class="l-table-edit-td">
                    <span class="l-star"></span>&nbsp;企业信息:
                </td>
                <td align="left" class="l-table-edit-td" colspan="5">
                    <textarea name="EnterpriceInfo" rows="4" cols="123">@project.Enterprise.EnterpriceInfo</textarea>
                </td>
            </tr>
            <tr>
                <td align="right" class="l-table-edit-td">
                    <span class="l-star">*</span>&nbsp;资金用途:
                </td>
                <td align="left" class="l-table-edit-td" colspan="5">
                    <textarea name="CapitalOperation" rows="4" cols="123">@project.Enterprise.CapitalOperation</textarea>
                </td>
            </tr>
        </table>
    </div>
    <div id="guarcpyinfo" style="padding-left:10px;">
        <table cellpadding="0" cellspacing="0" class="l-table-edit">
            <tr>
                <td align="right" class="l-table-edit-td">
                    <a href="javascript:;" style="text-decoration:none; color:Black;"><strong><h3>风险控制</h3></strong></a>
                </td>
            </tr>
            <tr>
                <td align="left" class="l-table-edit-td">
                    <span class="l-star">*</span>&nbsp;担保公司:
                </td>
                <td align="left" class="l-table-edit-td">
                    <input id="GuaranteeCompany" name="GuaranteeCompany" ltype="select" />
                </td>
            </tr>
            <tr>
                <td align="right" class="l-table-edit-td">
                    <span class="l-star">*</span>&nbsp;担保意见:
                </td>
                <td align="left" class="l-table-edit-td">
                    <textarea name="CollateralOpinion" rows="4" cols="123" >@project.CollateralOpinion</textarea>
                </td>
            </tr>
            <tr>
                <td align="right" class="l-table-edit-td">
                    <span class="l-star">*</span>&nbsp;风险控制:
                </td>
                <td align="left" class="l-table-edit-td" colspan="3">
                    <textarea name="RiskCotrolSummary" rows="4" cols="123">@project.RiskCotrolSummary</textarea>
                </td>
            </tr>
        </table>
    </div>
    <div id="policyinfo" style="padding-left:10px;">
        <table cellpadding="0" cellspacing="0" class="l-table-edit">
            <tr>
                <td align="right" class="l-table-edit-td">
                    <a href="javascript:;" style="text-decoration:none; color:Black;"><strong><h3>策略信息</h3></strong></a>
                </td>
            </tr>
            <tr>
                <td align="right" class="l-table-edit-td">
                    <span class="l-star">*</span>&nbsp;策略名称:
                </td>
                <td align="left" class="l-table-edit-td">
                    <input name="PolicyName" ltype="text" value="@project.Policy.PolicyName" />
                </td>
                <td align="right" class="l-table-edit-td">
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="l-star">*</span>&nbsp;结算周期:
                </td>
                <td align="left" class="l-table-edit-td">
                    <input name="Duration" ltype="text" ligerui="width:100" style="width:100;" value="@project.Policy.Duration"/>
                </td>
                <td align="left">
                    <input name="DurationType" ltype="select" ligerui="width:65" style="width: 65;" value="@project.Policy.DurationType"/> 
                </td>
            </tr>
            <tr>
                <td align="right" class="l-table-edit-td">
                    <span class="l-star">*</span>&nbsp;计算方式:
                </td>
                <td align="left" class="l-table-edit-td">
                    <input name="SettlementType" ltype="select" value="@project.Policy.SettlementType" /> 
                </td>
                <td align="right" class="l-table-edit-td">
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="l-star">*</span>&nbsp;结算方式:
                </td>
                <td align="left" class="l-table-edit-td" colspan="2">
                    <input name="BalanceType" ltype="select" value="@project.Policy.BalanceType" /> 
                </td>
                <td align="right" class="l-table-edit-td">
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="l-star">*</span>&nbsp;年化收益:
                </td>
                <td align="left" class="l-table-edit-td">
                    <input name="Rate" ltype="text" ligerui="width:160" style="width:160;" value="@project.Policy.Rate" />
                </td>
                <td align="left">
                    <span id="danwei" ligerui="width:60" style="width:60;"></span>
                </td>
            </tr>
            <tr>
                <td id="tdselpolicy" align="right" class="l-table-edit-td">
                    <span class="l-star"></span>&nbsp;已选策略:
                </td>
                <td align="left" class="l-table-edit-td" colspan="5">
                @{
                    foreach (var policy in project.PolicyList)
                    {
                        if (policy.IsAttach)
                        {
                            var durationtype = policy.DurationType == DurationType.ByDay ? "日" : "月";
                            var balancetype = "";
                            BalanceType balType = policy.BalanceType;
                            switch (balType)
                            {
                                case BalanceType.AverCapitalInterest:
                                    balancetype = "每期等额本金利息";
                                    break;
                                case BalanceType.EachInterestTerminalCapital:
                                    balancetype = "每期结息到期还本";
                                    break;
                                case BalanceType.EverageFixed:
                                    balancetype = "每期固定收益";
                                    break;
                                case BalanceType.TerminalCapitalInterest:
                                    balancetype = "到期结本息";
                                    break;
                                case BalanceType.TerminalFixed:
                                    balancetype = "到期固定收益";
                                    break;
                                default:
                                    balancetype = "每期等额本金利息";
                                    break;
                            }
                            var settlementtype = policy.SettlementType == SettlementType.Fixed ? "固定值" : "按比例";
                            var tempstr = "[" + policy.PolicyName + "]" + "年化收益" + policy.Rate + "分" + policy.CycleAmount + "期(" + policy.Duration + durationtype + "/期)" + settlementtype + "以" + balancetype + "结算";
                            <div id="@policy.ID"><span>@tempstr &nbsp;</span><a href="javascript:void(0)" onclick="clearpolicy(@policy.ID)" style="text-decoration:none;">[取消]</a><br /></div>
                        }
                    }
                }
                <span id="selspepolicy"></span>
                </td>
            </tr>
            <tr>
                <td align="right" class="l-table-edit-td">
                    <span class="l-star"></span>&nbsp;特殊策略:
                </td>
                <td align="left" class="l-table-edit-td" colspan="4">
                    <input name="SpeicalPolicy" ltype="select" ligerui="width:465" style="width:465;" /> 
                </td>
                <td align="left" class="l-table-edit-td">
                    <input id="btnAddSpePolicy" type="button" value="添加" class="l-button" /> 
                </td>
            </tr>
        </table>
    </div>
    <div id="proresource" style="padding-left:10px;">
        <table cellpadding="0" cellspacing="0" class="l-table-edit">
            <tr>
                <td align="right" class="l-table-edit-td">
                    <a href="javascript:;" style="text-decoration:none; color:Black;"><strong><h3>项目资料</h3></strong></a>
                </td>
            </tr>
            <tr>
                <td align="right" class="l-table-edit-td">
                    <span class="l-star">*</span>&nbsp;协议资料:
                </td>
                <td align="right" class="l-table-edit-td">
                    <input type="button" id="btnFileUpload" value="点击上传" class="l-button" onclick="LoadUploadControl()" />
                </td>
                <td align="left" class="l-table-edit-td">
                    <div id="resList" style="width:100%; height:100%;">
                        @{
                        foreach (var resource in project.ResourceList)
                        {
                            var id = resource.Name.Split('.')[0];
                            <img id="@id" alt="@resource.Name" title="@resource.Name" src="@resource.Path" style="width:115px; height:95px;"/>
                            @*<a href="javascript:void(0)" onclick="clearresource('@id')" style="float:right;"><br /><img alt="删除" style="width:16px;height:16px;" src="/Content/scripts/swfupload/Trash_Delete.png" /></a>*@
                        }
                    }
                    </div>
                </td>
            </tr>
            <tr>
                <td align="center" colspan="7">
                    <br />
                    <span id="lblmsg" class="l-validate-error">&nbsp;</span>
                </td>
            </tr>
        </table>
    </div>
    <br />
    <div id="btn" style="padding-left:10px;">
        <table cellpadding="0" cellspacing="0" class="l-table-edit">
            <tr>
                <td align="center" style="width:70px;"></td>
                <td align="center">
                    <input name="btnSave" type="button" value="保存" class="l-button" /> 
                    <input name="btnSubmit" type="button" value="提交" class="l-button" />
                    <input type="button" value="取消" name="btnCancel" class="l-button" />
                </td>
            </tr>
        </table>
    </div>
    <br />
</div>

<div id="fileuploadframe" style="display:none; position:absolute; width:550px;height:481px;z-index:99999;">
<div style="height:25px;width:100%; border-bottom:1px solid #ccc">
<div style="float:right;width:80px; height:23px; line-height:23px;">
    <a href="javascript:;"><img alt="关闭" style="border:none;" id="btnflfclose" src="/Content/scripts/swfupload/closelabel.gif"/></a>
</div>
</div>
<div style="width:100%;height:455px;">
    <div id="fileuploadframe_imgbox" style="width:100%;height:410px; overflow:auto;">
    </div>
    <div id="fileuploadframe_controlbox" style="width:100%;height:45px;">
        <div id="fileupload" style="float:left;width:130px;"></div>
        <div id="fileuploadframe_hint" style="font-size:12px;padding-top:20px; float:left;width:320px;"></div>
        <div id="fileuploadframe_btnsubmit" style="float:right;"><input id="btnupload" type="button" class="l-button" value="完成" /></div>
    </div>
</div>

</div>
</form>
</div>